public class Product {  
    private int id;  
    private String title;  
    private double price;  
  
    // Constructors, getters, and setters  
    public Product(int id, String title, double price) {  
        this.id = id;  
        this.title = title;  
        this.price = price;  
    }  
  
    public int getId() {  
        return id;  
    }  
  
    public String getTitle() {  
        return title;  
    }  
  
    public void setTitle(String title) {  
        this.title = title;  
    }  
  
    public double getPrice() {  
        return price;  
    }  
  
    public void setPrice(double price) {  
        this.price = price;  
    }  
  
    // Additional methods for Product can be added here  
}  
  
// OrderDetail.java  
public class OrderDetail {  
    private int id;  
    private Product product;  
    private int quantity;  
    private Order order; // This field represents the back-reference to the Order  
  
    // Constructors, getters, and setters  
    public OrderDetail(int id, Product product, int quantity, Order order) {  
        this.id = id;  
        this.product = product;  
        this.quantity = quantity;  
        this.order = order; // Set the back-reference  
    }  
  
    // Note: In a real-world application, you might want to use a setter for the order  
    // field only during the creation of the OrderDetail, and then make it private or final.  
  
    public int getId() {  
        return id;  
    }  
  
    public Product getProduct() {  
        return product;  
    }  
  
    public void setProduct(Product product) {  
        this.product = product;  
    }  
  
    public int getQuantity() {  
        return quantity;  
    }  
  
    public void setQuantity(int quantity) {  
        this.quantity = quantity;  
    }  
  
    public Order getOrder() {  
        return order;  
    }  
  
    // Additional methods for OrderDetail can be added here  
}  
  
// Order.java  
import java.util.ArrayList;  
import java.util.Date;  
import java.util.List;  
  
public class Order {  
    private int id;  
    private Date createDate;  
    private Customer customer;  
    private List<OrderDetail> orderDetails;  
  
    // Constructors, getters, and setters  
    public Order(int id, Date createDate, Customer customer) {  
        this.id = id;  
        this.createDate = createDate;  
        this.customer = customer;  
        this.orderDetails = new ArrayList<>();  
    }  
  
    public int getId() {  
        return id;  
    }  
  
    public Date getCreateDate() {  
        return createDate;  
    }  
  
    public void setCreateDate(Date createDate) {  
        this.createDate = createDate;  
    }  
  
    public Customer getCustomer() {  
        return customer;  
    }  
  
    public List<OrderDetail> getOrderDetails() {  
        return orderDetails;  
    }  
  
    public void addOrderDetail(OrderDetail orderDetail) {  
        // In a real-world application, you might want to ensure that the orderDetail's order  
        // field is set to this Order before adding it to the list.  
        orderDetails.add(orderDetail);  
    }  
  
    // Additional methods for Order can be added here  
}  
  
// Customer.java  
public class Customer {  
    private int id;  
    private String name;  
    private String email;  
    // Note: There is no direct reference to Order in Customer in this simplified model.  
    // Instead, the relationship is managed through the Order class.  
  
    // Constructors, getters, and setters  
    public Customer(int id, String name, String email) {  
        this.id = id;  
        this.name = name;  
        this.email = email;  
    }  
  
    public int getId() {  
        return id;  
    }  
  
    public String getName() {  
        return name;  
    }  
  
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public String getEmail() {  
        return email;  
    }  
  
    public void setEmail(String email) {  
        this.email = email;  
    }  
  
    // Additional methods for Customer can be added here  
}  
  
// Main.java (for testing purposes)  
import java.util.Date;  
  
public class Main {  
    public static void main(String[] args) {  
        // Create some sample data  
        Product product1 = new Product(1, "Laptop", 999.99);  
        Product product2 = new Product(2, "Smartphone", 499.99);  
  
        Customer customer = new Customer(1, "John Doe", "john.doe@example.com");  
  
        Order order = new Order(1, new Date(), customer);  
  
        OrderDetail detail1 = new OrderDetail(1, product1, 1, order);  
        OrderDetail detail2 = new OrderDetail(2, product2, 2, order);  
  
        order.addOrderDetail(detail1);  
        order.addOrderDetail(detail2);  
  
        // Verify the relationships  
        System.out.println("Customer: " + customer.getName());  
        System.out.println("Order ID: " + order.getId());  
        for (OrderDetail detail : order.getOrderDetails()) {  
            System.out.println(" - Product: " + detail.getProduct().getTitle() + ", Quantity: " + detail.getQuantity());  
        }  
    }  
}